﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Hangjing.Common;
using Hangjing.SQLServerDAL;
using Hangjing.Model;

/// <summary>
/// 分站通知
/// </summary>
public partial class Admin_groupnotice : System.Web.UI.Page
{
    DeliverGroup dal = new DeliverGroup();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DeliverGroupInfo info = dal.GetModel(HjNetHelper.GetQueryInt("gid", 0));
            FCKContent.Value = info.hovepic;
            tbshopnotice.Value = info.shopnotice;
        }
    }

    protected void btSave_Click(object sender, EventArgs e)
    {
        //判断权限
        int _rs = WebUtility.checkOperator(3);
        if (_rs == 0)
        {
            AlertScript.RegScript(this.Page, this.UpdatePanel1, "alert('无操作权限','success','true',5);init();");
            return;
        }

        string sql = "UPDATE dbo.DeliverGroup SET hovepic = '" + FCKContent.Value + "',shopnotice = '" + tbshopnotice.Value + "' WHERE id = " + HjNetHelper.GetQueryInt("gid", 0);
        if (WebUtility.excutesql(sql) > 0)
        {
            AlertScript.RegScript(this.Page, UpdatePanel1, "alert('设置成功','text:编辑成功!','250','150','true','3000','true','text');");
        }
        else
        {
            AlertScript.RegScript(this.Page, UpdatePanel1, "alert('设置失败','text:编辑失败!','250','150','true','3000','true','text');");
        }

    }


    /// <summary>
    /// 推送通知（设置未读）
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btsen_Click(object sender, EventArgs e)
    {
        //判断权限
        int _rs = WebUtility.checkOperator(3);
        if (_rs == 0)
        {
            AlertScript.RegScript(this.Page, this.UpdatePanel1, "alert('无操作权限','success','true',5);init();");
            return;
        }




        string sql = " DELETE noticereadlog WHERE mtype = " + ((Button)sender).CommandArgument;
        WebUtility.excutesql(sql);

        AlertScript.RegScript(this.Page, UpdatePanel1, "alert('设置成功','text:操作成功!','250','150','true','3000','true','text');");

    }
}
